<template>
    <div>
        <div v-if="currentPanel == 'list'">
            <el-card class="box-card" style="height: 850px">
                <!--搜索框-->
<!--                <el-card class="box-card">-->
                    <el-form :inline="true" :model="table" class="demo-form-inline">
                        <!--问答-->
                        <el-form-item v-if="selectGroup === '2'">
                            <el-input prefix-icon="el-icon-search" v-model="table.title" placeholder="问题"></el-input>
                        </el-form-item>
                        <!--名片-->
                        <el-form-item v-if="selectGroup === '5'">
                            <el-input prefix-icon="el-icon-search" v-model="table.title" placeholder="姓名"></el-input>
                        </el-form-item>
                        <!--小程序标题--表单标题--素材标题--文章标题--话术标题--问卷调查-->
                        <el-form-item v-if="selectGroup !== '2' && selectGroup !== '5'">
                            <el-input prefix-icon="el-icon-search" v-model="table.title" placeholder="标题"></el-input>
                        </el-form-item>
                        <!--促销活动-->
                        <!--<el-form-item v-if="selectGroup === '1'">
                            <el-input prefix-icon="el-icon-search" v-model="table.name" placeholder="活动名称"></el-input>
                        </el-form-item>-->
                        <el-form-item>
                            <el-select v-model="table.status" placeholder="审核状态">
                                <el-option label="待审核" value="待审核"></el-option>
                                <el-option label="审核通过" value="审核通过"></el-option>
                                <el-option label="审核未通过" value="审核未通过"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" @click="query">查询</el-button>
                            <el-button type="primary" @click="reset">重置</el-button>
                        </el-form-item>
                    </el-form>
<!--                </el-card>-->
                <div class="interspaceH"></div>
                <!--树-->
                <el-row>
                    <el-col :span="5">
                        <el-card class="box-card" style="width: 300px;height: 690px">
                            <span>模块列表</span>
                            <el-tree class="promotionList" :data="data" @node-click="handleNodeClick"></el-tree>
                        </el-card>
                    </el-col>
                    <!--表格-->
                    <el-col :span="19">
                        <div v-show="viewRight">
                            <el-card class="box-card" style="width: 920px;height: 690px">
                                <!--话术表格-->
                                <el-table v-if="selectGroup === '1'" :data="tableData" style="width: 100%">
                                    <el-table-column prop="conversationTitle" label="话术标题" width="184" :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <el-table-column prop="conversationMassage" label="附件内容" width="184" :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <el-table-column prop="conversationType" label="附件类型" width="">
                                    </el-table-column>
                                    <el-table-column label="审核状态" width="184">
                                        <template slot-scope="scope">
                                            <span v-if="scope.row.conversationStatus == '审核通过'" style="color: #00cc19">审核通过</span>
                                            <span v-if="scope.row.conversationStatus == '审核未通过'" style="color: #9394ad">审核未通过</span>
                                            <span v-if="scope.row.conversationStatus == '待审核'" style="color: #f69927">待审核</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column fixed="right" label="操作" width="">
                                        <template slot-scope="scope">
                                            <el-button type="text" @click="shenhe(scope.$index, scope.row)">审核</el-button>
                                        </template>
                                    </el-table-column>
                                </el-table>
                                <!--问答表格-->
                                <el-table v-if="selectGroup === '2'" :data="tableData" style="width: 100%">
                                    <el-table-column prop="askAnswerAsk" label="问题" width="" :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <el-table-column prop="keyWords" label="关键词" width="" :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <el-table-column prop="askAnswerAnswer" label="答案" width="" :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <el-table-column label="审核状态" width="">
                                        <template slot-scope="scope">
                                            <span v-if="scope.row.askAnswerStatus == '审核通过'" style="color: #00cc19">审核通过</span>
                                            <span v-if="scope.row.askAnswerStatus == '审核未通过'" style="color: #9394ad">审核未通过</span>
                                            <span v-if="scope.row.askAnswerStatus == '待审核'" style="color: #f69927">待审核</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column fixed="right" label="操作" width="">
                                        <template slot-scope="scope">
                                            <el-button type="text" @click="shenhe(scope.$index, scope.row)">审核</el-button>
                                        </template>
                                    </el-table-column>
                                </el-table>
                                <!--文章表格-->
                                <el-table v-if="selectGroup === '3'" :data="tableData" style="width: 100%">
                                    <el-table-column prop="articlesTitle" label="文章标题" width="230" :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <el-table-column prop="articlesDescription" label="文章简介" width="230" :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <!--<el-table-column prop="articlesURL" label="文章存放地址" width="400">
                                    </el-table-column>-->
                                    <el-table-column label="审核状态" width="230">
                                        <template slot-scope="scope">
                                            <span v-if="scope.row.articlesStatus == '审核通过'" style="color: #00cc19">审核通过</span>
                                            <span v-if="scope.row.articlesStatus == '审核未通过'" style="color: #9394ad">审核未通过</span>
                                            <span v-if="scope.row.articlesStatus == '待审核'" style="color: #f69927">待审核</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column fixed="right" label="操作" width="">
                                        <template slot-scope="scope">
                                            <el-button type="text" size="small" @click="shenhe(scope.$index, scope.row)">审核</el-button>
                                        </template>
                                    </el-table-column>
                                </el-table>
                                <!--素材表格-->
                                <el-table v-if="selectGroup === '4'" :data="tableData" style="width: 100%;">
                                    <el-table-column prop="materialTitle" label="素材标题" width="153" :show-overflow-tooltip="true"></el-table-column>
                                    <el-table-column prop="materialCreateTime" label="创建时间" width="153"></el-table-column>
                                    <el-table-column label="素材类型" width="153">
                                        <template slot-scope="scope">
                                            <span v-if="scope.row.materialType == 1">图文</span>
                                            <span v-if="scope.row.materialType == 2">PDF</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="materialLinksCover" label="附件" width="">
                                        <template slot-scope="scope">
                                            <el-image style="width: 50px;height: 50px" v-if="scope.row.materialType == 1" :src="fomateImg(scope.row.materialLinksCoverImg)" class="avatar"></el-image>
                                            <el-image style="width: 50px;height: 50px" v-if="scope.row.materialType == 2" :src="require('@/assets/img/Pdf.png')" class="avatar"></el-image>
                                        </template>
                                    </el-table-column>
                                    <el-table-column label="审核状态" width="">
                                        <template slot-scope="scope">
                                            <span v-if="scope.row.materialStatus == '审核通过'" style="color: #00cc19">审核通过</span>
                                            <span v-if="scope.row.materialStatus == '审核未通过'" style="color: #9394ad">审核未通过</span>
                                            <span v-if="scope.row.materialStatus == '待审核'" style="color: #f69927">待审核</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column fixed="right" label="操作" width="">
                                        <template slot-scope="scope">
                                            <el-button type="text" size="mini" @click="shenhe(scope.$index, scope.row)">审核</el-button>
                                        </template>
                                    </el-table-column>
                                </el-table>
                                <!--名片表格-->
                                <el-table v-if="selectGroup === '5'" :data="tableData" style="width: 100%">
                                    <el-table-column prop="cardName" label="姓名" width="130">
                                    </el-table-column>
                                    <el-table-column prop="cardJob" label="职务">
                                    </el-table-column>
                                    <el-table-column prop="cardPhone" label="手机号" width="130">
                                    </el-table-column>
                                    <el-table-column prop="cardEmail" label="邮箱">
                                    </el-table-column>
                                    <el-table-column prop="cardAddress" label="地区">
                                    </el-table-column>
                                    <el-table-column label="审核状态" width="130">
                                        <template slot-scope="scope">
                                            <span v-if="scope.row.cardStatus == '审核通过'" style="color: #00cc19">审核通过</span>
                                            <span v-if="scope.row.cardStatus == '审核未通过'" style="color: #9394ad">审核未通过</span>
                                            <span v-if="scope.row.cardStatus == '待审核'" style="color: #f69927">待审核</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column fixed="right" label="操作" width="100">
                                        <template slot-scope="scope">
                                            <el-button type="text" @click="shenhe(scope.$index, scope.row)">审核</el-button>
                                        </template>
                                    </el-table-column>
                                </el-table>
                                <!--表单表格-->
                                <el-table v-if="selectGroup === '6'" :data="tableData" style="width: 100%">
                                    <el-table-column prop="formsTitle" label="表单标题" width="" :show-overflow-tooltip="true"></el-table-column>
                                    <el-table-column prop="formsName" label="客户名" width=""></el-table-column>
                                    <el-table-column prop="formsPhone" label="电话" width=""></el-table-column>
                                    <el-table-column prop="formsAddress" label="电话" width=""></el-table-column>
                                    <el-table-column prop="formsNotes" label="备注"></el-table-column>
                                    <el-table-column label="审核状态" width="">
                                        <template slot-scope="scope">
                                            <span v-if="scope.row.formsStatus == '审核通过'" style="color: #00cc19">审核通过</span>
                                            <span v-if="scope.row.formsStatus == '审核未通过'" style="color: #9394ad">审核未通过</span>
                                            <span v-if="scope.row.formsStatus == '待审核'" style="color: #f69927">待审核</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column fixed="right" label="操作" width="">
                                        <template slot-scope="scope">
                                            <el-button type="text" @click="shenhe(scope.$index, scope.row)">审核</el-button>
                                        </template>
                                    </el-table-column>
                                </el-table>
                                <!--小程序表格-->
                                <el-table v-if="selectGroup === '7'" :data="tableData" style="width: 100%">
                                    <el-table-column prop="programTitle" label="标题" width="153" :show-overflow-tooltip="true"></el-table-column>
                                    <el-table-column prop="programMessage" label="内容" width="153" :show-overflow-tooltip="true"></el-table-column>
                                    <el-table-column prop="programImage" label="图片" width="153">
                                        <template slot-scope="scope">
                                            <el-image style="width: 50px; height: 50px" :src="fomateImg(scope.row.programImage)" fit="fill"></el-image>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="programUrl" label="链接" width="153" :show-overflow-tooltip="true"></el-table-column>
                                    <el-table-column label="审核状态" width="">
                                        <template slot-scope="scope">
                                            <span v-if="scope.row.programStatus == '审核通过'" style="color: #00cc19">审核通过</span>
                                            <span v-if="scope.row.programStatus == '审核未通过'" style="color: #9394ad">审核未通过</span>
                                            <span v-if="scope.row.programStatus == '待审核'" style="color: #f69927">待审核</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column fixed="right" label="操作" width="">
                                        <template slot-scope="scope">
                                            <el-button type="text" @click="shenhe(scope.$index, scope.row)">审核</el-button>
                                        </template>
                                    </el-table-column>
                                </el-table>
                                <!--问卷调查-->
                                <el-table v-if="selectGroup === '8'" :data="tableData" style="width: 100%">
                                    <el-table-column prop="formsTitle" label="问卷标题" :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <el-table-column prop="formsMessage" label="问卷内容" :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <el-table-column prop="formsNotes" label="备注" :show-overflow-tooltip="true">
                                    </el-table-column>
                                    <el-table-column prop="createTime" label="创建时间">
                                    </el-table-column>
                                    <el-table-column label="审核状态">
                                        <template slot-scope="scope">
                                            <span v-if="scope.row.formsStatus == '审核通过'" style="color: #00cc19">审核通过</span>
                                            <span v-if="scope.row.formsStatus == '审核未通过'" style="color: #9394ad">审核未通过</span>
                                            <span v-if="scope.row.formsStatus == '待审核'" style="color: #f69927">待审核</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column fixed="right" label="操作" width="100">
                                        <template slot-scope="scope">
                                            <el-button type="text" @click="shenhe(scope.$index, scope.row)">审核</el-button>
                                        </template>
                                    </el-table-column>
                                </el-table>
                                <!-- 分页组件 -->
                                <el-pagination @size-change="queryDataHandle(pagePagination.currentPage,$event)"
                                               @current-change="queryDataHandle($event,pagePagination.pageSize)"
                                               :current-page="pagePagination.currentPage"
                                               :page-sizes="pagePagination.pageSizes" :page-size="pagePagination.pageSize"
                                               layout="total, sizes, prev, pager, next"
                                               :total="pagePagination.total">
                                </el-pagination>
                            </el-card>

                        </div>
                    </el-col>
                </el-row>
            </el-card>
            <!--小程序审核-->
            <el-dialog v-if="selectGroup === '7'" title="审核小程序" :visible.sync="audit" width="30%"
                       :close-on-click-modal="false">
                <el-form ref="tableData" :model="viewData" label-width="70px" disabled>
                    <el-form-item label="标题" prop="title">
                        <el-input v-model="viewData.programTitle" style="width: 200px"></el-input>
                    </el-form-item>
                    <el-form-item label="内容" prop="massage">
                        <el-input type="textarea" autosize :autosize="{ minRows: 2, maxRows: 4}"
                                  v-model="viewData.programMessage"></el-input>
                    </el-form-item>
                    <el-form-item label="图片" prop="imageUrl">
                        <img style="width: 100px; height: 100px;" v-if="viewData.programImage" :src="fomateImg(viewData.programImage)" class="avatar">
                    </el-form-item>
                    <el-form-item label="链接" prop="url">
                        <el-input v-model="viewData.programUrl" style="width: 200px"></el-input>
                    </el-form-item>
                    <el-form-item label="状态" prop="programStatus">
                        <el-input v-model="viewData.programStatus" style="width: 200px"></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button size="small" @click="close">审核未通过</el-button>
                    <el-button size="small" type="primary" class="title" @click="save">审核通过</el-button>
                </div>
            </el-dialog>
            <!--表单审核-->
            <el-dialog v-if="selectGroup === '6'" title="审核表单" :visible.sync="audit" width="30%"
                       :close-on-click-modal="false">
                <el-form label-width="120px" :model="viewData" ref="editForm" disabled>
                    <el-form-item label="表单标题" prop="formsTitle">
                        <el-input size="small" v-model="viewData.formsTitle"></el-input>
                    </el-form-item>
                    <el-form-item label="客户名" prop="formsName">
                        <el-input size="small" v-model="viewData.formsName"></el-input>
                    </el-form-item>
                    <el-form-item label="电话" prop="formsPhone">
                        <el-input size="small" v-model="viewData.formsPhone"></el-input>
                    </el-form-item>
                    <el-form-item label="地址" prop="formsAddress">
                        <el-input size="small" v-model="viewData.formsAddress"></el-input>
                    </el-form-item>
                    <el-form-item label="备注" prop="formsNotes">
                        <el-input size="small" v-model="viewData.formsNotes"></el-input>
                    </el-form-item>
                    <el-form-item label="审核状态" prop="formsStatus">
                        <el-input size="small" v-model="viewData.formsStatus"></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button size="small" @click="close">审核未通过</el-button>
                    <el-button size="small" type="primary" class="title" @click="save">审核通过</el-button>
                </div>
            </el-dialog>
            <!--名片审核-->
            <el-dialog v-if="selectGroup === '5'" title="审核名片" :visible.sync="audit" width="30%"
                       :close-on-click-modal="false">
                <el-form label-width="120px" :model="viewData" ref="editForm" disabled>
                    <el-form-item label="姓名" prop="name">
                        <el-input size="small" v-model="viewData.cardName"></el-input>
                    </el-form-item>
                    <el-form-item label="职务" prop="name">
                        <el-input size="small" v-model="viewData.cardJob"></el-input>
                    </el-form-item>
                    <el-form-item label="手机号码" prop="name">
                        <el-input size="small" v-model="viewData.cardPhone"></el-input>
                    </el-form-item>
                    <el-form-item label="邮箱" prop="name">
                        <el-input size="small" v-model="viewData.cardEmail"></el-input>
                    </el-form-item>
                    <el-form-item label="地区" prop="name">
                        <el-input size="small" v-model="viewData.cardAddress"></el-input>
                    </el-form-item>
                    <el-form-item label="公司" prop="name">
                        <el-input size="small" v-model="viewData.cardCompany"></el-input>
                    </el-form-item>
                    <el-form-item label="状态" prop="name">
                        <el-input size="small" v-model="viewData.cardStatus"></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button size="small" @click="close">审核未通过</el-button>
                    <el-button size="small" type="primary" @click="save">审核通过</el-button>
                </div>
            </el-dialog>
            <!--素材审核-->
            <el-dialog v-if="selectGroup === '4'" title="审核素材" :visible.sync="audit" width="30%"
                       :close-on-click-modal="false">
                <el-form ref="form" :model="viewData" label-width="80px" disabled>
                    <el-form-item label="素材标题">
                        <el-input v-model="viewData.materialTitle"></el-input>
                    </el-form-item>
                    <el-form-item label="文件类型">
                        <el-radio-group v-model="viewData.materialType">
                            <el-radio label="1">图文</el-radio>
                            <el-radio label="2">PDF</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="显示效果">
                        <el-image v-if="viewData.materialType == 1" style="width: 100px; height: 100px" :src="fomateImg(viewData.materialLinksCoverImg)" fit="fill" :preview-src-list="materialTrackTypeMax"></el-image>
                        <el-image v-if="viewData.materialType == 2" style="width: 50px; height: 50px" :src="require('@/assets/img/Pdf.png')" fit="fill" @click="materialAppendices"></el-image>
                    </el-form-item>
                </el-form>
                <div>
                    <h6>连接追踪设置</h6>
                    <el-checkbox-group v-model="materialTrackType" disabled>
                        <el-checkbox label="1">行为追踪(当客户点击素材链接时,发送素材链接的员工将会收到通知)</el-checkbox>
                        <el-checkbox label="2">动态记录(当客户点击素材链接时，会将客户的行为记录在客户动态里)</el-checkbox>
                    </el-checkbox-group>
                </div>
                <div slot="footer" class="dialog-footer">
                    <el-button size="mini" @click="close">审核未通过</el-button>
                    <el-button size="mini" type="primary" @click="save">审核通过</el-button>
                </div>
            </el-dialog>
            <!--文章-->
            <el-dialog v-if="selectGroup === '3'" title="审核文章" :visible.sync="audit" width="65%"
                       :close-on-click-modal="false">
                <el-form label-width="120px" :model="viewData" ref="editForm" disabled>
                    <el-form-item label="文章标题">
                        <el-input v-model="viewData.articlesTitle"></el-input>
                    </el-form-item>
                    <el-form-item label="文章简介">
                        <el-input v-model="viewData.articlesDescription"></el-input>
                    </el-form-item>
                    <Tinymce v-model="viewData.articlesAppendices" :height="300" placeholder="在这里输入文字"/>
                    <el-form-item label="审核状态" prop="appendices_type">
                        <el-input size="small" v-model="viewData.articlesStatus"></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button size="small" @click="close">审核未通过</el-button>
                    <el-button size="small" type="primary" class="title" @click="save">审核通过</el-button>
                </div>
            </el-dialog>
            <!--问答-->
            <el-dialog v-if="selectGroup === '2'" title="审核问答" :visible.sync="audit" width="30%"
                       :close-on-click-modal="false">
                <el-form label-width="120px" :model="viewData" ref="editForm" disabled>
                    <el-form-item label="问题">
                        <el-input v-model="viewData.askAnswerAsk"></el-input>
                    </el-form-item>
                    <el-form-item label="关键词">
                        <el-input v-model="viewData.keyWords"></el-input>
                    </el-form-item>
                    <el-form-item label="答案">
                        <el-input type="textarea" v-model="viewData.askAnswerAnswer" autosize></el-input>
                    </el-form-item>
                    <el-form-item label="审核状态" prop="appendices_type">
                        <el-input size="small" v-model="viewData.askAnswerStatus"></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button size="small" @click="close">审核未通过</el-button>
                    <el-button size="small" type="primary" class="title" @click="save">审核通过
                    </el-button>
                </div>
            </el-dialog>
            <!--话术-->
            <el-dialog v-if="selectGroup === '1'" title="审核话术" :visible.sync="audit" width="30%"
                       :close-on-click-modal="false">
                <el-form ref="form" :model="viewData" label-width="80px" disabled>
                    <el-form-item label="话术标题" prop="title">
                        <el-input size="small" v-model="viewData.conversationTitle"></el-input>
                    </el-form-item>
                    <el-form-item label="话术内容" prop="massage">
                        <el-input type="textarea" autosize size="small" v-model="viewData.conversationMassage"></el-input>
                    </el-form-item>
                    <el-form-item label="附件类型" prop="appendices_type">
                        <el-input size="small" v-model="viewData.conversationType"></el-input>
                    </el-form-item>
                    <el-form-item label="审核状态" prop="appendices_type">
                        <el-input size="small" v-model="viewData.conversationStatus"></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button size="mini" @click="close">审核未通过</el-button>
                    <el-button size="mini" type="primary" @click="save">审核通过</el-button>
                </div>
            </el-dialog>

        </div>
        <!--<div v-if="currentPanel == 'wheel'">
            <wheel @currentHandler=currentHandler></wheel>
        </div>
        <div v-if="currentPanel == 'tts'">
            <tts @currentHandler=currentHandler></tts>
        </div>
        <div v-if="currentPanel == 'fission'">
            <fission @currentHandler=currentHandler></fission>
        </div>
        <div v-if="currentPanel == 'offline'">
            <offline @currentHandler=currentHandler></offline>
        </div>-->
    </div>
</template>

<script>
    import Tinymce from '@/components/tinymce/index.vue'
    import wheel from '@/views/content/promotion/wheel'
    import tts from '@/views/content/promotion/tts'
    import fission from '@/views/content/promotion/fission'
    import offline from '@/views/content/promotion/offline'

    const initQuery = {
        title: '',
        status: ''
    }
    export default {
        components: {
            Tinymce,
            wheel,
            tts,
            fission,
            offline,
        },
        name: "list",
        data() {
            return {
                currentPanel: 'list',
                viewRight: false,
                //审核页面
                audit: false,
                table: {
                    title: '',
                    status: ''
                },
                tableData: [],
                viewData: {},

                //树
                data: [
                    {id: '1', label: '话术管理',},
                    {id: '2', label: '问答管理',},
                    {id: '3', label: '文章管理',},
                    {id: '4', label: '素材管理',},
                    {id: '5', label: '名片管理',},
                    {id: '6', label: '表单管理',},
                    {id: '7', label: '小程序管理',},
                    /*{id: '8',label: '促销活动',}, */
                    // {id: '8', label: '问卷调查',}
                ],

                selectGroup: '',

                // 分页参数
                pagePagination: {
                    currentPage: 1,
                    pageSizes: [10, 15, 20, 25],
                    pageSize: 10,
                    total: 0
                },
            }
        },
        methods: {
            fomateImg(img){
                return "http://localhost:8088/common/download/"+img
            },
            materialAppendices(){
                window.open(this.$uri + this.viewData.materialAppendices)
            },
            shenhe(index,row) {
                this.viewData = {...row}
                this.audit = true
            },
            //审核未通过
            close() {
                this.auditRes({message:'审核未通过',type:'error'});
            },
            //审核通过
            save() {
                this.auditRes({message:'审核通过',type:'success'});
            },

            selectId(){
                switch (this.selectGroup) {
                    case "1": return this.viewData.conversationId;
                    case "2": return this.viewData.askAnswerId;
                    case "3": return this.viewData.articlesId;
                    case "4": return this.viewData.materialId;
                    case "5": return this.viewData.businessCardId;
                    case "6": return this.viewData.formsId;
                    case "7": return this.viewData.programId;
                    case "8": return this.viewData.formsId;
                }
            },

            auditRes(d){
                let that = this;
                let payload = {
                    category: that.selectGroup, //类别查询
                    dataId: this.selectId(),
                    status: d.message,  //状态查询
                }
                that.$request("/contentReview/updateStatus", payload, "POST").then((data) => {
                    this.$message({
                        message: d.message,
                        type: d.type
                    })
                    this.audit = false
                    this.handleNodeClick({id:this.selectGroup})
                })
            },

            query(){
                if (this.selectGroup === ''){
                    this.$message.error("请先选择分组！")
                    return;
                }
                this.handleNodeClick({id:this.selectGroup})
            },

            handleNodeClick(data) {
                let that = this;
                that.viewRight = true;
                that.selectGroup = data.id;
                let payload = {
                    category: that.selectGroup, //类别查询
                    status: that.table.status,  //状态查询
                    title: that.table.title,    //标题名称查询
                    pageNum: that.pagePagination.currentPage,
                    pageSize: that.pagePagination.pageSize
                }
                that.$request("/contentReview/getByStatus", payload, "POST").then((data) => {
                    that.tableData = data.data.data
                    that.pagePagination['total'] = data.data.total
                })
            },
            queryDataHandle(page = 1, row = 10) {
                let that = this;
                let payload = {
                    category: that.selectGroup, //类别查询
                    status: that.table.status,  //状态查询
                    title: that.table.title,    //标题名称查询
                    pageNum: page,
                    pageSize: row
                }
                that.$request("/contentReview/getByStatus", payload, "POST").then((data) => {
                    that.tableData = data.rows
                    that.pagePagination['total'] = data.total
                    that.pagePagination['pageSize'] = row
                })
            },
            reset(){
                this.table = {...initQuery}
            },
        },
        computed:{
            materialTrackType(){
                if (this.viewData.materialTrackType != undefined){
                    return this.viewData.materialTrackType.split(',')
                }else {
                    return 0
                }
            },
            materialTrackTypeMax(){
                return [this.viewData.materialLinksCover]
            },
        }
    }
</script>

<style>
    .promotionList .el-tree-node {
        white-space: nowrap;
        outline: 0;
        padding-top: 10px;
    }
    .hidden-text{
        width:200px;
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
    }
</style>
